package com.ocom.common.enums.icbcyxt;


import com.ocom.common.enums.ResultEnum;

/**
 * 服务间调用code msg
 */
public enum IcbcYxtResultEnum {

    Success_Success("0000", "成功"),
    Err_0002("0002", "报文MAC验证失败"),
    Err_0003("0003", "订单重复提交"),
    Err_0004("0004", "订单不存在"),
    Err_0100("0100", "商户号不存在"),
    Err_0101("0101", "商户校园一卡通已关闭"),
    Err_0200("0200", "账户不存在"),
    Err_0201("0201", "账户处于非正常状态"),
    Err_0202("0202", "编号验证未通过"),
    Err_0203("0203", "姓名验证未通过"),
    Err_0300("0300", "充值服务关闭或暂停"),
    Err_0400("0400", "充值失败"),
    Err_0500("0500", "本月充值次数超过限制次数"),
    Err_9999("9999", "未知错误");

    private final String key;
    private final String msg;

    IcbcYxtResultEnum(String key, String msg) {
        this.key = key;
        this.msg = msg;
    }

    public String getKey() {
        return key;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * 根据key获取value
     *
     * @param key : 键值key
     * @return String
     */
    public static String getValueByKey(String key) {
        IcbcYxtResultEnum[] enums = IcbcYxtResultEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getKey().equals(key)) {
                return enums[i].getMsg();
            }
        }
        return "";
    }


    public static void main(String[] args) {
        System.out.println(IcbcYxtResultEnum.Err_0003.getKey());
        System.out.println(ResultEnum.Err_203.getKey());

    }
}
